#include <rtthread.h>
#include <board.h>
#include <rtdevice.h>
#include "my_gpio.h"

ALIGN(RT_ALIGN_SIZE)
static rt_uint8_t wchdog_stack[ 512 ];
static struct rt_thread wchdog_thread;
static void wchdog_thread_entry(void* parameter);

void wchdog_thread_init(void)
{
    rt_err_t result;

    result = rt_thread_init(&wchdog_thread,
                            "wchdog",
                            wchdog_thread_entry,
                            RT_NULL,
                            (rt_uint8_t*)&wchdog_stack[0],
                            sizeof(wchdog_stack),
                            21,
                            5);
    if (result == RT_EOK)
    {
        rt_thread_startup(&wchdog_thread);
    }


}

static void wchdog_thread_entry(void* parameter)
{
    while(1)
    {
        LED0_TOGGLE();
        rt_thread_mdelay(1000);
    }
}
